package com.efast.dmom.aps.service.impl;

import java.util.List;
import java.util.Map;

import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.efast.dmom.aps.bean.Plan;
import com.efast.dmom.aps.bean.ResultBean;
import com.efast.dmom.aps.constant.ServiceConstants;
import com.efast.dmom.aps.dao.PlanDao;
import com.efast.dmom.aps.service.PlanWebService;
import com.efast.dmom.aps.util.TimeUtil;
@WebService(name = "webservices" ,targetNamespace ="http://services" ,endpointInterface = "com.efast.dmom.aps.service.PlanWebService")
@Service
public class PlanWebServiceImpl implements PlanWebService{
	@Autowired
	private PlanDao planDao;

	@Override
	public ResultBean quaryPlanNoTransmitLesInfo() {
		// TODO Auto-generated method stub
		ResultBean result = new ResultBean(true);
//		List<Plan> historyInfoList = planDao.quaryPlanNoTransmitLesInfo(ServiceConstants.APS_PLAN_TRANSMIT_HISTORY_STATUS_NO);
//		result.setObject(historyInfoList);
		return result;
	}

	@Override
	public ResultBean quaryPlanNoTransmitMesInfo() {
		// TODO Auto-generated method stub
		ResultBean result = new ResultBean(true);
//		List<Plan> historyInfoList = planDao.quaryPlanNoTransmitMesInfo(ServiceConstants.APS_PLAN_TRANSMIT_HISTORY_STATUS_NO);
//		result.setObject(historyInfoList);
		return result;
	}

	@Override
	public void updatePlanTransmitLesInfo(String jsonData) {
		// TODO Auto-generated method stub
//		Plan plan= new Plan();
//		plan.setLastModifiedTime(TimeUtil.getLocalDateTime());
//		@SuppressWarnings("unchecked")
//		Map<String, Object> map = (Map<String, Object>) JSON.parse(jsonData);
//		String user=map.get("user").toString();
//	    plan.setLastModifier(user);
//	    plan.setIsTransmitLes(ServiceConstants.APS_PLAN_TRANSMIT_HISTORY_STATUS_YES);
//		@SuppressWarnings("unchecked")
//		List<String> list =(List<String>) map.get("id");
//		if(list !=null && list.size()>0) {
//			for(int i=0;i<list.size();i++) {
//				plan.setId( Integer.parseInt(list.get(i)));
//				planDao.updatePlanTransmitHistoryLesStatus(plan);
//			}
//		}
		
	}

	@Override
	public void updatePlanTransmitMesInfo(String jsonData) {
		// TODO Auto-generated method stub
//		Plan plan= new Plan();
//		plan.setLastModifiedTime(TimeUtil.getLocalDateTime());
//		@SuppressWarnings("unchecked")
//		Map<String, Object> map = (Map<String, Object>) JSON.parse(jsonData);
//		String user=map.get("user").toString();
//	    plan.setLastModifier(user);
//	    plan.setIsTransmitMes(ServiceConstants.APS_PLAN_TRANSMIT_HISTORY_STATUS_YES);
//		@SuppressWarnings("unchecked")
//		List<String> list =(List<String>) map.get("id");
//		if(list !=null && list.size()>0) {
//			for(int i=0;i<list.size();i++) {
//				plan.setId( Integer.parseInt(list.get(i)));
//				planDao.updatePlanTransmitHistoryMesStatus(plan);
//			}
//		}
	}

}
